﻿<Window x:Class="Mantin.Controls.Wpf.Notification.ToastPopUp"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="NotificationWindow" Width="300" SizeToContent="Height" ShowInTaskbar="False"
        WindowStyle="None" AllowsTransparency="True" 
        Background="Transparent">
    
    <Grid RenderTransformOrigin="0,1" >
		<Grid.Resources>
			<LinearGradientBrush x:Key="GradientHeaderBackground" EndPoint="0.504,1.5" StartPoint="0.504,0.03">
				<GradientStop Color="#FFFDD5A7" Offset="0"/>
				<GradientStop Color="#FFFCE79F" Offset="0.567"/>
			</LinearGradientBrush>

            <Style x:Key="LinkButton" TargetType="Button">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Button">
                            <TextBlock>
                            <ContentPresenter />
                            </TextBlock>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="Foreground" Value="Blue"/>
                <Setter Property="Cursor" Value="Hand"/>
                <Style.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="ContentTemplate">
                            <Setter.Value>
                                <DataTemplate>
                                    <TextBlock TextDecorations="Underline" Text="{TemplateBinding Content}"/>
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="NotificationLinkButton" TargetType="Button" BasedOn="{StaticResource LinkButton}">
                <Setter Property="FontSize" Value="13"/>
            </Style>
        </Grid.Resources>
        <Border BorderThickness="2" Background="{StaticResource GradientHeaderBackground}" BorderBrush="DarkGray" CornerRadius="7">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="60"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="30"/>
                </Grid.ColumnDefinitions>
            
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>               
                
                <Image Grid.Column="0" 
                       Grid.RowSpan="3" 
                       Source="Resources/information.png" 
                       Width="42" 
                       Height="42" 
                       Margin="0,10,0,0"
                       x:Name="imageLeft"
                       VerticalAlignment="Top" 
                       HorizontalAlignment="Center"/>

                <Image Grid.Column="2" 
                       Grid.RowSpan="2"
                       Source="Resources/delete24.png"
                       Width="20" 
                       Height="20" 
                       Margin="0,6,0,0"
                       VerticalAlignment="Top" 
                       ToolTip="Close"
                       HorizontalAlignment="Center" 
                       Cursor="Hand" MouseUp="ImageMouseUp"/>

                <TextBlock Grid.Column="1" 
                           Grid.Row="0"
                           x:Name="TextBoxTitle"
                           Margin="0,5,0,5"
                           VerticalAlignment="Center"
                           TextWrapping="Wrap"
                           HorizontalAlignment="Left"                           
                           FontWeight="Bold" FontSize="14"
                           Text="A Request has been Added"/>

                <TextBlock Grid.Column="1" 
                           x:Name="TextBoxShortDescription"
                           Margin="0,3,5,0"
                           Grid.ColumnSpan="2"
                           Grid.Row="1"                         
                           TextWrapping="Wrap"
                           FontSize="13"
                           Text="A Request has been Added"/>

                <Button Grid.Column="0"
                        Grid.ColumnSpan="3"
                        Grid.Row="2"
                        Margin="0,5,0,10" 
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Content="Click Here to View" 
                        x:Name="buttonView"
                        Visibility="Collapsed"
                        Style="{StaticResource NotificationLinkButton}" 
                        Click="ButtonViewClick"/>
            </Grid>            
        </Border>

        <!-- Animation -->
        <Grid.Triggers>
            <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                <BeginStoryboard x:Name="StoryboardLoad">
                    <Storyboard>
                        <DoubleAnimation Storyboard.TargetProperty="(UIElement.Opacity)" From="0.0" To="1.0" Duration="0:0:2" />
                        <DoubleAnimation Storyboard.TargetProperty="(UIElement.Opacity)" From="1.0" To="0.0" Duration="0:0:6" BeginTime="0:0:5" Completed="DoubleAnimationCompleted"/>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>

            <EventTrigger RoutedEvent="Mouse.MouseEnter">
                <EventTrigger.Actions>
                    <RemoveStoryboard BeginStoryboardName="StoryboardLoad"/>
                    <RemoveStoryboard BeginStoryboardName="StoryboardFade"/>
                </EventTrigger.Actions>
            </EventTrigger>

            <EventTrigger RoutedEvent="Mouse.MouseLeave">
                <BeginStoryboard x:Name="StoryboardFade">
                    <Storyboard>
                        <DoubleAnimation Storyboard.TargetProperty="(UIElement.Opacity)" From="1.0" To="0.0" Duration="0:0:8" BeginTime="0:0:2" Completed="DoubleAnimationCompleted"/>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>

        </Grid.Triggers>

        <Grid.RenderTransform>
            <ScaleTransform ScaleY="1" />
        </Grid.RenderTransform>
    </Grid>
</Window>
